const qrCreate = require('qr-image')
const fs = require('fs')

// 0:御藏 1:御品
var type = 0

for (let i = 1000; i < 2000; i++) {
  var userStr = `https://wjun94.github.io/h5/#/pages/index/index?idx=${i}&type=${type}`
  var qr_png = qrCreate.image(userStr, { ec_level: '33', type: 'png' })
  var img = fs.createWriteStream(`./image${type + 1}/${i < 1000 ? '1-1000' : '1000-2000'}/${i + 1}.png`)
  qr_png.pipe(img)
  for (let j = 0; j < 6; j++) {
    var qrPng = qrCreate.image(`${userStr}&num=${j}`, { ec_level: '33', type: 'png' })
    var imgs = fs.createWriteStream(`./image${type + 1}/${i < 1000 ? '1-1000' : '1000-2000'}/${i + 1}-${j + 1}.png`)
    qrPng.pipe(imgs)
  }
}

/* for (let i = 0; i < 2000; i++) {
  console.log(22)
  var userStr = `https://wjun94.github.io/h5/#/pages/index/index?idx=${i}&type=${type}`
  for (let j = 0; j < 6; j++) {
    console.log(11)
    var qrPng = qrCreate.image(`${userStr}&num=${j}`, { ec_level: '33', type: 'png' })
    var imgs = fs.createWriteStream(`./image${type + 1}/${i + 1}-${j + 1}.png`)
    qrPng.pipe(imgs)
  }
} */
